﻿namespace Homework2_2
{
    /// <summary>
    /// establish a file ,named hello.txt ,and write down the precise time ,then save it
    /// </summary>
    internal class Program
    {
        static void Main(string[] args)
        {
            // choose the file path
            string filePath = @"D:\CSharp2024\hello.txt";

            // get the current time
            string currentTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm");

            // establish and open the file ,then save the time into it.
            File.WriteAllText(filePath, currentTime);

            Console.WriteLine($"文件 {filePath} 创建成功，包含当前时间为 {currentTime}");
        }
    }
}
